xcel=14;ycel=10
function INT(a)
  return(a-a%1)
  end
rn=0;rv=0;ro=0;ri=0
bn=0;bv=0;bo=0;bi=0
gn=0;gv=0;go=0;gi=0
for y2=0,height,ycel do
  for x2=0,width,xcel do
    for y1=0,ycel-1,1 do
      for x1=0,xcel-1,1 do
        x=x2+x1;y=y2+y1
        amtc=0
        ro=rn;go=gn;bo=bn
        rn,gn,bn=get_rgb(x,y)
        rn=rn*255;gn=gn*255;bn=bn*255
        rn=INT(rn/16)*17
        gn=INT(gn/16)*17
        bn=INT(bn/16)*17
        if ro~=rn then amtc=amtc+1 end
        if go~=gn then amtc=amtc+1 end
        if go~=gn then amtc=amtc+1 end
        if amtc==3 then
          rv=rn;gv=gn;bv=bn;ri=rv;gi=gv;bi=bv
          end
        set_rgb(x,y,ri/255,gi/255,bi/255)
        end;end;end
  progress(y/height)
  end
flush()

